<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 创建promise实例
        const promise=new Promise((resolve,reject)=>{
            // promise创建时内部回调代码会立即执行 异步就要耗时
            setTimeout(()=>{
                //  resolve('成功') 
                reject(new Error('失败'))
            },3000)
        }).then(res=>{
            console.log(res);
        }).catch(error=>{
        console.log(error);
        })

        // promise 三个状态：pending 等待中  fulfilled 成功  rejected 已拒绝
        // 成功走.then   失败走.catch





       let obj={
        tiem:'1',
        a:0,
        b:0
       }
       let objs={
        tiem:'2024-01-01',
        a:1,
        b:2
       }
    //    obj.tiem=(new Date(obj.tiem)).getTime()
    //    console.log(obj.tiem);
       console.log(obj['tiem']);
        for (const key in obj) {
            //   console.log('1',key);
            //   console.log('2',obj[key]);
            //   console.log(objs[key]);   
              objs[key]=obj[key]

              console.log(   objs[key]=obj[key]);
              
        }
        console.log(objs);
        



           
 const va = [
    {name:'a',age:2},
    {name:'b',age:8},
    {name:'c',age:9},
    {name:'d',age:5},
   ]
 const va1 = {
    name:"q",
    age1:2,
    city:'000',
    sex:'n'
 }
 va.forEach((item) => {
    console.log(item);
})

console.log('------------------');

 va.map((item) => {
    console.log(item);
})

    </script>
</body>
</html>